﻿using Masuit.Tools.Systems;
using sixgod.Enum.System;
using sixgod.Model.System.Menu;

namespace sixgod.Dtos.System
{
    public class MenuDto
    {
        public string Code { get; set; }
        
        public string MenuName { get; set; }

        public MenuTypeEnum Type { get; set; }

        public int Order { get; set; }

        public string ComponentRoute {get;set;}

        public string PermissionCode { get; set; }

        /// <summary>
        /// 路由地址
        /// </summary>
        public string Route { get; set; }

        public string ParentMenu { get; set; }

        public bool status { get; set; }

        /// <summary>
        /// 子菜单
        /// </summary>
        public List<MenuDto> ChildMenus { get; set; }

        public bool HaveChildren { get; set; }

        public void CheckChildren(List<SystemMenu> list)
        {
            HaveChildren = list.Any(r=>r.ParentCode == Code);
        }
    }
}
